package com.yuanren.em.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@TableName("t_member_level")
public class MemberLevel extends Model<MemberLevel> {
    
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    
    private String levelName;
    
    private String levelCode;
    
    private Integer minPoints;
    
    private Integer maxPoints;
    
    private BigDecimal discountRate;
    
    private BigDecimal pointsRatio;
    
    private String levelIcon;
    
    private String levelColor;
    
    private String description;
    
    private Boolean isActive;
    
    private Integer sortOrder;
    
    private Date createTime;
    
    private Date updateTime;
    
    // 关联字段，不在数据库中存储
    @TableField(exist = false)
    private List<MemberBenefit> benefits;
    
    @TableField(exist = false)
    private Integer userCount; // 该等级用户数量

    public MemberLevel() {}

    public MemberLevel(String levelName, String levelCode, Integer minPoints, Integer maxPoints, 
                      BigDecimal discountRate, BigDecimal pointsRatio, String description) {
        this.levelName = levelName;
        this.levelCode = levelCode;
        this.minPoints = minPoints;
        this.maxPoints = maxPoints;
        this.discountRate = discountRate;
        this.pointsRatio = pointsRatio;
        this.description = description;
        this.isActive = true;
        this.sortOrder = 0;
    }

    // Getters and Setters
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getLevelName() {
        return levelName;
    }

    public void setLevelName(String levelName) {
        this.levelName = levelName;
    }

    public String getLevelCode() {
        return levelCode;
    }

    public void setLevelCode(String levelCode) {
        this.levelCode = levelCode;
    }

    public Integer getMinPoints() {
        return minPoints;
    }

    public void setMinPoints(Integer minPoints) {
        this.minPoints = minPoints;
    }

    public Integer getMaxPoints() {
        return maxPoints;
    }

    public void setMaxPoints(Integer maxPoints) {
        this.maxPoints = maxPoints;
    }

    public BigDecimal getDiscountRate() {
        return discountRate;
    }

    public void setDiscountRate(BigDecimal discountRate) {
        this.discountRate = discountRate;
    }

    public BigDecimal getPointsRatio() {
        return pointsRatio;
    }

    public void setPointsRatio(BigDecimal pointsRatio) {
        this.pointsRatio = pointsRatio;
    }

    public String getLevelIcon() {
        return levelIcon;
    }

    public void setLevelIcon(String levelIcon) {
        this.levelIcon = levelIcon;
    }

    public String getLevelColor() {
        return levelColor;
    }

    public void setLevelColor(String levelColor) {
        this.levelColor = levelColor;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Boolean getIsActive() {
        return isActive;
    }

    public void setIsActive(Boolean isActive) {
        this.isActive = isActive;
    }

    public Integer getSortOrder() {
        return sortOrder;
    }

    public void setSortOrder(Integer sortOrder) {
        this.sortOrder = sortOrder;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public List<MemberBenefit> getBenefits() {
        return benefits;
    }

    public void setBenefits(List<MemberBenefit> benefits) {
        this.benefits = benefits;
    }

    public Integer getUserCount() {
        return userCount;
    }

    public void setUserCount(Integer userCount) {
        this.userCount = userCount;
    }

    @Override
    public String toString() {
        return "MemberLevel{" +
                "id=" + id +
                ", levelName='" + levelName + '\'' +
                ", levelCode='" + levelCode + '\'' +
                ", minPoints=" + minPoints +
                ", maxPoints=" + maxPoints +
                ", discountRate=" + discountRate +
                ", pointsRatio=" + pointsRatio +
                ", levelIcon='" + levelIcon + '\'' +
                ", levelColor='" + levelColor + '\'' +
                ", description='" + description + '\'' +
                ", isActive=" + isActive +
                ", sortOrder=" + sortOrder +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                '}';
    }
} 